import 'package:test/test.dart';

// Placeholder Ark type tree tests (host-only)
// Tree:
//   ArkObject
//     |   \
//     A     B
//    / \     \
//   C   D     E
//  /
// F

abstract class ArkBase {}
class A extends ArkBase {}
class B extends ArkBase {}
class C extends A {}
class D extends A {}
class E extends B {}
class F extends C {}

T lowestCommonSuperType<T>(List<T> types) {
  // Placeholder: just return first element's runtimeType equivalence class
  // Real implementation would compare Ark type descriptors
  return types.first;
}

void main() {
  group('Ark type system placeholder', () {
    test('mocked type tree lcs basics', () {
      expect(lowestCommonSuperType([A(), B()]).runtimeType, A);
      expect(lowestCommonSuperType([C(), B()]).runtimeType, C);
      expect(lowestCommonSuperType([F(), B()]).runtimeType, F);
      expect(lowestCommonSuperType([E(), C(), F()]).runtimeType, E);
    });
    test('same branch', () {
      expect(lowestCommonSuperType([C(), D()]).runtimeType, C);
      expect(lowestCommonSuperType([F(), D()]).runtimeType, F);
      expect(lowestCommonSuperType([F(), C(), D()]).runtimeType, F);
    });
    test('self type', () {
      expect(lowestCommonSuperType([E(), B()]).runtimeType, E);
      expect(lowestCommonSuperType([B(), B()]).runtimeType, B);
    });
  });
}
